<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class ModifyEventFields extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasColumn('event', 'customer_name')) {
            return;
        }
        Schema::table('event', function (Blueprint $table) {
            $table->string('customer_name')->after('customer_id')->default('')->comment('费用');
            $table->unsignedInteger('province_id')->default(0)->after('project_name')->comment('省份ID');
            $table->unsignedInteger('city_id')->default(0)->after('province_id')->comment('城市ID');
            $table->unsignedInteger('county_id')->default(0)->after('city_id')->comment('区县ID');
            $table->string('product_number')->default('')->after('project_name')->comment('设备编号');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
